package com.platform.data;

import com.platform.data.model.ReadDataModel;
import com.platform.data.model.WriteDataModel;
import com.platform.data.service.ProcessDataService;
import com.platform.data.service.ReadAndWriteExcelService;
import com.platform.data.service.impl.ProcessDataServiceImpl;
import com.platform.data.service.impl.ReadAndWriteExcelServiceImpl;
import com.platform.data.utils.ObjectUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * 主程序类
 */
public class PlatformStationDataApplication {
    private static Logger log = LoggerFactory.getLogger(PlatformStationDataApplication.class);

    /**
     * 程序入口
     *
     * @param args args
     */
	public static void main(String[] args) {
        //String filePath = "D:\\迅雷下载\\成都政府对接-充电站.xlsx";
        String filePath = "D:\\迅雷下载\\内蒙能源局和蒙西电力集团电站-新协议.xlsx";

        // 解析文件内容
        ReadAndWriteExcelService excelService = new ReadAndWriteExcelServiceImpl();
        List<ReadDataModel> readDataList = excelService.read(filePath);

        // 组装数据
        ProcessDataService processService = new ProcessDataServiceImpl();
        List<WriteDataModel> writeDataList = processService.precessData(readDataList);
        for (WriteDataModel dataModel : writeDataList) {
            log.info("输出解析后JSON字符串，电站ID：{}, JSON字符串：{}", dataModel.getStationId(), ObjectUtil.objToStr(dataModel.getBodyModel()));
        }
    }

}
